package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.SystemDictionary;
import cn.wolfcode.crm.mapper.SystemDictionaryMapper;
import cn.wolfcode.crm.qo.QueryObject;
import cn.wolfcode.crm.service.ISystemDictionaryService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemDictionaryServiceImpl implements ISystemDictionaryService{
	@Autowired
	private SystemDictionaryMapper systemDictionaryMapper;
	@Override
	public void insert(SystemDictionary systemDictionary) {
		systemDictionaryMapper.insert(systemDictionary);
	}

	@Override
	public void delete(Long id) {
		systemDictionaryMapper.delete(id);
	}

	@Override
	public void update(SystemDictionary systemDictionary) {
		systemDictionaryMapper.update(systemDictionary);
	}

	@Override
	public SystemDictionary select(Long id) {
		SystemDictionary systemDictionary = systemDictionaryMapper.select(id);
		return systemDictionary;
	}

	@Override
	public List<SystemDictionary> list() {
		List<SystemDictionary> list = systemDictionaryMapper.list();
		return list;
	}

	public PageInfo<SystemDictionary> query(QueryObject qo) {
		PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<SystemDictionary> systemDictionarys = systemDictionaryMapper.selectForList(qo);
        return new PageInfo<>(systemDictionarys);
	}



}
